package com.zeny.edu.stas.controller;


import com.zeny.edu.common.ResponseResult;
import com.zeny.edu.stas.entity.dto.SearchDto;
import com.zeny.edu.stas.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author zeny
 * @since 2020-03-08
 */
@RestController
@RequestMapping("/stas/daily")
@CrossOrigin
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService statisticsDailyService;


    /**
     * @Description 获取注册人数
     * @Date 2020/3/8 0008 16:51
     * @param day
     * @return com.zeny.edu.common.ResponseResult
     **/
    @GetMapping("/getStasDay/{day}")
    public ResponseResult getStasDay(@PathVariable String day) {
        statisticsDailyService.getCountRegisterNum(day);
        return ResponseResult.ok();
    }

    /**
     * @Description 返回图表数据
     * @Date 2020/3/9 0009 10:27
     * @param searchDto
     * @return com.zeny.edu.common.ResponseResult
     **/
    @PostMapping("/getCountData")
    public ResponseResult getCountData(@RequestBody SearchDto searchDto) {
        Map<String, Object> map = statisticsDailyService.getCountData(searchDto);
        return ResponseResult.ok().data(map);
    }

}

